﻿using CleanArchitecture.Infrastructure.Entities.AdminUsers;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace CleanArchitecture.Infrastructure.DataMapping.AdminUsers
{
    /// <summary>
    /// Represents a customer role mapping configuration
    /// </summary>
    public partial class AdminRoleMap : NowaEntityTypeConfiguration<AdminRole>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<AdminRole> builder)
        {
            builder.ToTable("admin_role");
            builder.HasKey(role => role.Id);

            builder.Property(role => role.RoleName).HasMaxLength(255).IsRequired();
            builder.Property(role => role.FKOrganizeId).HasColumnName("FK_OrganizeId");
            builder.HasOne(role => role.Organize)
                .WithMany()
                .HasForeignKey(role => role.FKOrganizeId)
                .IsRequired();

            base.Configure(builder);
        }

        #endregion
    }

    //public partial class AdminRoleNoMappingMap : NowaEntityTypeConfiguration<AdminRoleNoMapping>
    //{
    //    #region Methods

    //    /// <summary>
    //    /// Configures the entity
    //    /// </summary>
    //    /// <param name="builder">The builder to be used to configure the entity</param>
    //    public override void Configure(EntityTypeBuilder<AdminRoleNoMapping> builder)
    //    {
    //        builder.ToTable("admin_role");
    //        builder.HasKey(role => role.Id);

    //        builder.Property(role => role.RoleName).HasMaxLength(255).IsRequired();
    //        builder.Property(role => role.FKOrganizeId).HasColumnName("FK_OrganizeId");
    //        builder.HasOne(role => role.Organize)
    //            .WithMany()
    //            .HasForeignKey(role => role.FKOrganizeId)
    //            .IsRequired();

    //        base.Configure(builder);
    //    }

    //    #endregion
    //}
}
